<?php
/**
 *
 * PHP 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       Cake.View.Layouts
 * @since         CakePHP(tm) v 0.10.0.1076
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */

//$cakeDescription = __d('cake_dev', 'CakePHP: the rapid development php framework');
$rhDescription="Биллинг Radioheart.ru";
$current_controller=$this->params['controller'];
$current_action=$this->params['action'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<?php echo $this->Html->charset(); ?>
	<title>
		<?php echo $rhDescription ?>:
		<?php echo $title_for_layout; ?>
	</title>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script>
        <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />
        <link href='http://fonts.googleapis.com/css?family=PT+Sans&subset=latin,cyrillic' rel='stylesheet' type='text/css'>	<?php
		echo $this->Html->meta('icon');

		//echo $this->Html->css('cake.generic');
		echo $this->Html->css('../style');

		echo $this->fetch('meta');
		echo $this->fetch('css');
		echo $this->fetch('script');
		//echo $this->Html->script('jquery-1.6.4.min');
		echo $this->Html->script('pGenerator.jquery');
		echo $this->Html->script('encr');
		echo $this->Html->script('jquery.md5');
		echo $this->Html->script('jquery.cookie');
		echo $this->Html->script('jquery.placeholder.min');
		echo $this->Html->css('../style_steps');
                echo $this->Html->css('../style_step2');
	?>
        <script type="text/javascript">
            function logo_heartbit()
            {
                $(".logo").animate({ opacity: 0.4 },2000).animate({ opacity: 1 },2000);
            }
            $(document).ready(function(){
                /*
                logo_heartbit();
                var beats=setInterval('logo_heartbit()',4000);
                $(".logo").hover(function(){
                    $(".logo").animate({ opacity: 1 },1000);
                    clearInterval(beats);
                },function(){
                    logo_heartbit();
                    var beats=setInterval('logo_heartbit()',4000); }); */
		//Neworderlink disabler
		$('.gotoorder a').click(function(){
			//alert('122');
			return false;	
		});

            });
        </script>
                <script type="text/javascript">
            $(document).ready(function(){
                /*Изначально ставим все на 0*/
                clearAllCookies();
		$("#radio_host_switcher").attr("checked", false);
		$("#web_host_switcher").attr("checked", false);
                $.cookie('step2_current_tab', 'tarifs', { expires: 1 });
                calculate();
                $('input[name="reencode"]').change(function(){
                    var value = $(this).val();
                    $.cookie('reencode', value, { expires: 1 });
                    calculate();
                });
                $('input[name="stats"]').change(function(){
                    if($(this).is(':checked'))
                        var value=1;
                    else
                        var value=0;
                    $.cookie('stats', value, { expires: 1 });
                    calculate();
                });
                $('input[name="crossfade"]').change(function(){
                    if($(this).is(':checked'))
                        var value=1;
                    else
                        var value=0;
                    $.cookie('crossfade', value, { expires: 1 });
                    calculate();
                });
		$('input[name="cloud_service"]').change(function(){
                    if($(this).is(':checked'))
                    {
                        var autodj=$.cookie('autodj');
                        if(autodj>0)
                            var value=1;
                        else
                        {
                          var value=0;
                          alert("Подключение облачного хранилища доступно только при покупке автодиджея от 1ГБ");
                          $(this).removeAttr("checked");
                        }
                    }
                    else
                        var value=0;
                    $.cookie('cloud_service', value, { expires: 1 });
                    calculate();
                });
                $('input[name="webhost"]').change(function(){
                    var value = $(this).val();
                    $.cookie('webhost', value, { expires: 1 });
                    calculate();
                });
                /*tarif plans switchers*/
                //$("#radio_host_switcher_label").click(function(){
		$("#radio_host_switcher").click(function(){
                    if($(".rh_radio_plans_disabler").is(':visible'))
                    {
                      $(".rh_radio_plans_disabler").hide();
                      var bitrate=$('input[name=radio_host_bitrates]:radio:checked').val();
                      var listeners=$('input[name=radio_host_plans_item]:radio:checked').val();
                      $.cookie('bitrate', bitrate, { expires: 1 });
                      $.cookie('listeners', listeners, { expires: 1 });
                      findparamsbylisteners(listeners);
		      $('.gotoorder a').unbind('click');
                    }
                    else
                    {
                      $(".rh_radio_plans_disabler").show();
                      $.cookie('reencode', 0, { expires: 1 });
                      $.cookie('stats', 0, { expires: 1 });
                      $.cookie('crossfade', 0, { expires: 1 });
                      $.cookie('bitrate', 0, { expires: 1 });
                      $.cookie('listeners', 0, { expires: 1 });
                      $.cookie('autodj', 0, { expires: 1 });
		      $.cookie('cloud_service', 0, { expires: 1 });
                    }
                    calculate();
                });
                /*tarif web plans switchers*/
		//$("#web_host_switcher_label").click(function(){
                $("#web_host_switcher").click(function(){
                    if($(".rh_radio_plans_disabler").is(':visible'))
                    {
                      $.cookie('reencode', 0, { expires: 1 });
                      $.cookie('stats', 0, { expires: 1 });
                      $.cookie('crossfade', 0, { expires: 1 });
                      $.cookie('bitrate', 0, { expires: 1 });
                      $.cookie('listeners', 0, { expires: 1 });
                      $.cookie('autodj', 0, { expires: 1 });
		      $.cookie('cloud_service', 0, { expires: 1 });
		      $('.gotoorder a').unbind('click');
                    }
                    if($(".web_host_disabler").is(':visible'))
                    {
                      $(".web_host_disabler").hide();
                      $.cookie('webhost', 1, { expires: 1 });
                    }
                    else
                    {
                      $(".web_host_disabler").show();
                      $.cookie('webhost', 0, { expires: 1 });
                    }
                    calculate();
                });
                /*Tarifs plans radio bitrate choose*/
                $(".radiohostbitrates").click(function(){
                  var bitrate=$(this).val();
                  $.cookie('bitrate', bitrate, { expires: 1 });
                  calculate();
                });
                $(".radiohostlisteners").click(function(){
                  var listeners=$(this).val();
                  $.cookie('listeners', listeners, { expires: 1 });
                  findparamsbylisteners(listeners);
                  calculate();
                });
                /* Tarifs web host plan shoose*/
                $(".webhostitem").click(function(){
                  var webhost=$(this).val();
                  $.cookie('webhost', webhost, { expires: 1 });
                  calculate();
                });
                /*Actions selections*/
                $(".host_actions").click(function(){
                  var action=$(this).val();
                  var bitrate=128;
                  $.cookie('bitrate', bitrate, { expires: 1 });
                  $.cookie('webhost', action, { expires: 1 });
                  $.cookie('step2_action', action, { expires: 1 });
                  switch (action) {
                    case '1':
                      var listeners='100';
                      break;
                    case '2':
                      var listeners='250';
                      break;
                    case '3':
                     var listeners='400';
                      break;//case
                  }
                  $.cookie('listeners', listeners, { expires: 1 });
                  findparamsbylisteners(listeners);
                  calculate();
                  makediscount(action);
                });

            });
            function makediscount(action) {
                switch (action) {
                    case '1':
                      var percent=0.1;
                      break;
                    case '2':
                      var percent=0.15;
                      break;
                    case '3':
                     var percent=0.2;
                      break;//case
                  }
                var cost=$.cookie('cost');
                cost=cost-cost*percent;
                $.cookie('cost', cost, { expires: 1 });
                $("#result_cost").html(cost+" $");
                var sale3month=cost*0.95;
                var sale6month=cost*0.9;
                var sale12month=cost*0.85;
                $("#sale3month").html(sale3month.toFixed(2)+" $");
                $("#sale6month").html(sale6month.toFixed(2)+" $");
                $("#sale12month").html(sale12month.toFixed(2)+" $");//code
            }
            function findparamsbylisteners(listeners) {
                  switch (listeners) {
                    case '30':
                      $.cookie('autodj', 1, { expires: 1 });
                      $.cookie('reencode', 0, { expires: 1 });
                      $.cookie('stats', 0, { expires: 1 });
                      $.cookie('crossfade', 0, { expires: 1 });
                      break;
                    case '50':
                      $.cookie('autodj', 5, { expires: 1 });
                      $.cookie('reencode', 0, { expires: 1 });
                      $.cookie('stats', 0, { expires: 1 });
                      $.cookie('crossfade', 0, { expires: 1 });
                      break;
                    case '100':
                      $.cookie('autodj', 10, { expires: 1 });
                      $.cookie('reencode', 1, { expires: 1 });
                      $.cookie('stats', 1, { expires: 1 });
                      $.cookie('crossfade', 1, { expires: 1 });
		      $.cookie('cloud_service', 1, { expires: 1 });
                      break;
                    case '250':
                      $.cookie('autodj', 25, { expires: 1 });
                      $.cookie('reencode', 2, { expires: 1 });
                      $.cookie('stats', 1, { expires: 1 });
                      $.cookie('crossfade', 1, { expires: 1 });
		      $.cookie('cloud_service', 1, { expires: 1 });
                      break;
                    case '400':
                      $.cookie('autodj', 40, { expires: 1 });
                      $.cookie('reencode', 3, { expires: 1 });
                      $.cookie('stats', 1, { expires: 1 });
                      $.cookie('crossfade', 1, { expires: 1 });
		      $.cookie('cloud_service', 1, { expires: 1 });
                      break;//case
                  }              //code
            }
            function clearAllCookies() {
                $.cookie('reencode', 0, { expires: 1 });
                $.cookie('stats', 0, { expires: 1 });
                $.cookie('crossfade', 0, { expires: 1 });
                $.cookie('bitrate', 0, { expires: 1 });
                $.cookie('listeners', 0, { expires: 1 });
                $.cookie('autodj', 0, { expires: 1 });
                $.cookie('webhost', 0, { expires: 1 });
		$.cookie('cloud_service', 0, { expires: 1 });
              //code
            }
            function calculate()
            {
                var bitrate=$.cookie('bitrate');
                var listeners=$.cookie('listeners');
                var autodj=$.cookie('autodj');
                var reencode=$.cookie('reencode');
                var stats=$.cookie('stats');
                var crossfade=$.cookie('crossfade');
		var cloud_service=$.cookie('cloud_service'); 
                var webhost_num=$.cookie('webhost');
                $.cookie('cost', 0, { expires: 1 });

                var webhost;
                var cost=0;
                switch(bitrate){
                    case '64':{
                            switch(listeners)
                            {
                                case '30':cost=cost+1;break;
                                case '50':cost=cost+2;break;
                                case '100':cost=cost+4;break;
                                case '150':cost=cost+6;break;
                                case '200':cost=cost+8;break;
                                case '250':cost=cost+10;break;
                                case '300':cost=cost+12;break;
                                case '350':cost=cost+15;break;
                                case '400':cost=cost+18;break;
                                case '450':cost=cost+21;break;
                                case '500':cost=cost+24;break;
                            }
                    };break;
                    case '128':{
                            switch(listeners)
                            {
                                case '30':cost=cost+2;break;
                                case '50':cost=cost+4;break;
                                case '100':cost=cost+8;break;
                                case '150':cost=cost+12;break;
                                case '200':cost=cost+16;break;
                                case '250':cost=cost+20;break;
                                case '300':cost=cost+24;break;
                                case '350':cost=cost+30;break;
                                case '400':cost=cost+36;break;
                                case '450':cost=cost+42;break;
                                case '500':cost=cost+48;break;
                            }
                    };break;
                    case '192':{
                            switch(listeners)
                            {
                                case '30':cost=cost+3;break;
                                case '50':cost=cost+6;break;
                                case '100':cost=cost+12;break;
                                case '150':cost=cost+18;break;
                                case '200':cost=cost+24;break;
                                case '250':cost=cost+30;break;
                                case '300':cost=cost+36;break;
                                case '350':cost=cost+45;break;
                                case '400':cost=cost+54;break;
                                case '450':cost=cost+63;break;
                                case '500':cost=cost+72;break;
                            }
                    }break;
                    case '256':{
                            switch(listeners)
                            {
                                case '30':cost=cost+4;break;
                                case '50':cost=cost+8;break;
                                case '100':cost=cost+16;break;
                                case '150':cost=cost+24;break;
                                case '200':cost=cost+32;break;
                                case '250':cost=cost+40;break;
                                case '300':cost=cost+48;break;
                                case '350':cost=cost+60;break;
                                case '400':cost=cost+72;break;
                                case '450':cost=cost+84;break;
                                case '500':cost=cost+96;break;
                            }
                    }break;
                }
                var radiohostbitrate=listeners+" слотов ("+bitrate+" кбит) - "+cost+" $";
                $("#radiohostbitrate").html(radiohostbitrate);
                var autodj_cost;
                var reencode_cost;
                var crossfade_cost;
                var stats_cost;
		//////////////
		var cloud_service_cost;
                
		//////
                if(listeners>=30 && listeners<50){
                  if($.cookie('step2_current_tab')=='constructor')
                  {
                    cost=cost+0.5*parseFloat(autodj);
                    autodj_cost=0.5*parseFloat(autodj);
                  }
                  else
                  {
                    cost=cost+parseFloat(autodj);
                    autodj_cost=parseFloat(autodj);
		    cloud_service=0;
                  }
                    cost=cost+2*parseFloat(stats);
                    stats_cost=2*parseFloat(stats);
                    cost=cost+parseFloat(crossfade);
                    crossfade_cost=parseFloat(crossfade);
                    cost=cost+2*parseFloat(reencode);
                    reencode_cost=2*parseFloat(reencode);
		    cost=cost+3*parseFloat(cloud_service);
                    cloud_service_cost=3*parseFloat(cloud_service);
                }
                if(listeners==50){
                  if($.cookie('step2_current_tab')=='constructor')
                  {
                    cost=cost+0.5*parseFloat(autodj);
                    autodj_cost=0.5*parseFloat(autodj);
                  }
                  else
                  {
                    cost=cost+0.5*parseFloat(autodj)-0.5;
                    autodj_cost=0.5*parseFloat(autodj)-0.5;
		    cloud_service=0;
                  }
                    cost=cost+1*parseFloat(stats);
                    stats_cost=1*parseFloat(stats);
                    cost=cost+parseFloat(crossfade);
                    crossfade_cost=parseFloat(crossfade);
                    cost=cost+2*parseFloat(reencode);
                    reencode_cost=2*parseFloat(reencode);
		    cost=cost+3*parseFloat(cloud_service);
                    cloud_service_cost=3*parseFloat(cloud_service);
                }
                if(listeners==100){
		  if($.cookie('step2_current_tab')=='constructor')
                  {
                    cost=cost+parseFloat(crossfade);
                    crossfade_cost=parseFloat(crossfade);
		    cost=cost+1*parseFloat(stats);
                    stats_cost=1*parseFloat(stats);
		    cost=cost+0.5*parseFloat(autodj);
		    autodj_cost=0.4*parseFloat(autodj);
		    reencode_cost=2*parseFloat(reencode);
		    cost=cost+2*parseFloat(reencode);
		    cost=cost+3*parseFloat(cloud_service);
                    cloud_service_cost=3*parseFloat(cloud_service);
                  }
                  else
                  {
                    cost=cost+0.5*parseFloat(autodj);
                    autodj_cost=0.5*parseFloat(autodj);
                    //cost=cost+1*parseFloat(stats);
                    stats_cost=0;
                    //cost=cost+parseFloat(crossfade);
                    crossfade_cost=0;
                    cost=cost+2*parseFloat(reencode);
                    reencode_cost=2*parseFloat(reencode);
                    cloud_service_cost=0;
		  }
                }
                if(listeners>=150 && listeners<=200){
                    cost=cost+0.45*parseFloat(autodj);
                    autodj_cost=0.45*parseFloat(autodj);
                    cost=cost+0.5*parseFloat(stats);
                    stats_cost=0.5*parseFloat(stats);
                    cost=cost+parseFloat(crossfade);
                    crossfade_cost=parseFloat(crossfade);
                    cost=cost+1.75*parseFloat(reencode);
                    reencode_cost=1.75*parseFloat(reencode);
		    cost=cost+3*parseFloat(cloud_service);
                    cloud_service_cost=3*parseFloat(cloud_service);
                }
                if(listeners>=250 && listeners<=300){
                    cost=cost+0.4*parseFloat(autodj);
                    autodj_cost=0.4*parseFloat(autodj);
                    stats_cost=0;
                    //cost=cost+parseFloat(crossfade);
                    //crossfade_cost=0.5*parseFloat(crossfade);
                    if($.cookie('step2_current_tab')=='constructor')
                    {
                      cost=cost+1.5*parseFloat(reencode);
                      reencode_cost=1.5*parseFloat(reencode);
		      cost=cost+parseFloat(crossfade);
                      crossfade_cost=0.5*parseFloat(crossfade);
		      cost=cost+3*parseFloat(cloud_service);
                      cloud_service_cost=3*parseFloat(cloud_service);
                    }
                    else
                    {
                      //cost=cost+parseFloat(reencode);
                      reencode_cost=0;
		      //cost=cost+parseFloat(crossfade);
                      crossfade_cost=0;
		      cloud_service_cost=0;
                    }
                }
                if(listeners>=350 && listeners<=400){
                    cost=cost+0.35*parseFloat(autodj);
                    autodj_cost=0.35*parseFloat(autodj);
                    stats_cost=0;
                    crossfade_cost=0;
                    if($.cookie('step2_current_tab')=='constructor')
                    {
                      cost=cost+1.25*parseFloat(reencode);
                      reencode_cost=1.25*parseFloat(reencode);
		      cost=cost+3*parseFloat(cloud_service);
                      cloud_service_cost=3*parseFloat(cloud_service);
                    }
                    else
                    {
                      //cost=cost+1.25*parseFloat(reencode)+0.25;
                      reencode_cost=0;
		      cloud_service_cost=0;
                    }
                }
                if(listeners>=450 && listeners<=500){
                    cost=cost+0.3*parseFloat(autodj);
                    autodj_cost=0.3*parseFloat(autodj);
                    stats_cost=0;
                    crossfade_cost=0;
                    cost=cost+parseFloat(reencode);
                    reencode_cost=parseFloat(reencode);
		    cost=cost+3*parseFloat(cloud_service);
                    cloud_service_cost=3*parseFloat(cloud_service);
                }
		//cost=cost+3*parseFloat(cloud_service);
                //cloud_service_cost=3*parseFloat(cloud_service);
		$.cookie('cloud_service', cloud_service, { expires: 1 });
                if(reencode_cost==0)
                    reencode_cost="бесплатно - 0";
                if(crossfade_cost==0)
                    crossfade_cost="бесплатно - 0";
                if(stats_cost==0)
                    stats_cost="бесплатно - 0";
		if(cloud_service_cost==0)
                    cloud_service_cost="бесплатно - 0";
                var radiohostautodj;
                if(autodj==0){
                    radiohostautodj="Автодиджей не нужен - 0$"
                }
                else{
                    autodj_cost=autodj_cost.toFixed(2);
                    radiohostautodj=autodj+" ГБ дискового пространства автодиджея - "+autodj_cost+"$"
                }
                $("#radiohostautodj").html(radiohostautodj);
                var radiohostreencode;
                if(reencode==5)
                    radiohostreencode="Перекодировка: "+reencode+" потоков - "+reencode_cost+"$";
                else
                    radiohostreencode="Перекодировка: "+reencode+" потока - "+reencode_cost+"$";
                if(reencode==0)
                       radiohostreencode="Перекодировка: не нужна - 0$";
                $("#radiohostreencode").html(radiohostreencode);
                if(stats==1)
                    var radiohoststats="Детальная статистика - "+stats_cost+"$";
                else
                    var radiohoststats="Детальная статистика: не нужна - 0$";
                $("#radiohoststats").html(radiohoststats);
                if(crossfade==1)
                    var radiohostcrossfade="Кроссфейдинг - "+crossfade_cost+"$";
                else
                    var radiohostcrossfade="Кроссфейдинг: не нужен -0$";
                $("#radiohostcrossfade").html(radiohostcrossfade);
		if(cloud_service==1)
                    var radiohostcloud_service="Облачное хранилище - "+cloud_service_cost+"$";
                else
                    var radiohostcloud_service="Облачное хранилище: не нужно -0$";
                $("#radiohostcloud_service").html(radiohostcloud_service);
                switch(webhost_num){
                    case '0': webhost="Не нужен - 0$";break;
                    case '1': webhost="Тариф Extra "+webhost_num+" - 2$"; cost=cost+2;break;
                    case '2': webhost="Тариф Extra "+webhost_num+" - 6$"; cost=cost+6;break;
                    case '3': webhost="Тариф Extra "+webhost_num+" - 12$"; cost=cost+12;break;
                }
                $("#webhost").html(webhost);
                cost=cost.toFixed(2);
                $.cookie('cost', cost, { expires: 1 });
                $("#result_cost").html(cost+" $");
                var sale3month=cost*0.95;
                var sale6month=cost*0.9;
                var sale12month=cost*0.85;
                $("#sale3month").html(sale3month.toFixed(2)+" $");
                $("#sale6month").html(sale6month.toFixed(2)+" $");
                $("#sale12month").html(sale12month.toFixed(2)+" $");
            }
        </script>
        <script>
          $(function() {
            $( "#bitrate" ).slider({
              range: "max",
              min: 64,
              max: 256,
              value: 64,
              step:64,
              slide: function( event, ui ) {
                $.cookie('bitrate', ui.value, { expires: 1 });
                calculate();
              }
            });

            $( "#listeners" ).slider({
              range: "max",
              min: 50,
              max: 500,
              value: 50,
              step:50,
              slide: function( event, ui ) {
		var tmp=ui.value;
                $.cookie('listeners', ui.value, { expires: 1 });
                calculate();
              }
            });
            $( "#autodj" ).slider({
              range: "max",
              min: 0,
              max: 100,
              value: 0,
              step:1,
              slide: function( event, ui ) {
                  if(ui.value > 0)
                    $( "#amount" ).val( ui.value +" ГБ" );
                  else
                    $( "#amount" ).val( "Автодиджей не нужен" );
                $.cookie('autodj', ui.value, { expires: 1 });
                calculate();
              }
            });
            $( "#amount" ).val("Автодиджей не нужен");
            $.cookie('bitrate', $( "#bitrate" ).slider( "value" ), { expires: 1 });
            $.cookie('listeners', $( "#listeners" ).slider( "value" ), { expires: 1 });
            $.cookie('autodj', $( "#autodj" ).slider( "value" ), { expires: 1 });
          });
          function show_tarifs_info()
          {
              $(".constructor").hide();
              $(".actions_info").hide();
              $(".plans_info").fadeIn();
              $("#show_constructor_lnk").removeClass("step2menuitem_current");
              $("#show_actions_lnk").removeClass("step2menuitem_current");
              $("#show_tarifs_lnk").addClass("step2menuitem_current");
              clearAllCookies();
              $.cookie('step2_current_tab', 'tarifs', { expires: 1 });
              if($(".rh_radio_plans_disabler").is(':hidden'))
              {
                var bitrate=$('input[name=radio_host_bitrates]:radio:checked').val();
                $.cookie('bitrate', bitrate, { expires: 1 });
                var listeners=$('input[name=radio_host_plans_item]:radio:checked').val();
                $.cookie('listeners', listeners, { expires: 1 });
                findparamsbylisteners(listeners);
              }
              if($(".web_host_disabler").is(':hidden'))
              {
                var webhost=$('input[name=web_host_plans_item]:radio:checked').val();
                $.cookie('webhost', webhost, { expires: 1 })
              }
              calculate();
          }
          function show_constructior()
          {
		$('.gotoorder a').unbind('click');
              clearAllCookies();
              $.cookie('step2_current_tab', 'constructor', { expires: 1 });
              $.cookie('bitrate', $( "#bitrate" ).slider( "value" ), { expires: 1 });
              $.cookie('listeners', $( "#listeners" ).slider( "value" ), { expires: 1 });
              $.cookie('autodj', $( "#autodj" ).slider( "value" ), { expires: 1 });
              var reencode=$('input[name=reencode]:radio:checked').val();
              $.cookie('reencode', reencode, { expires: 1 });
              if($('input[name="stats"]').is(':checked'))
                var stats=1;
              else
                var stats=0;
              $.cookie('stats', stats, { expires: 1 });
              if($('input[name="crossfade"]').is(':checked'))
                var crossfade=1;
              else
                var crossfade=0;
              $.cookie('crossfade', crossfade, { expires: 1 });
              var webhost=$('input[name=webhost]:radio:checked').val();
              $.cookie('webhost', webhost, { expires: 1 });
              $(".plans_info").hide();
              $(".actions_info").hide();
              $(".constructor").fadeIn();
              $("#show_tarifs_lnk").removeClass("step2menuitem_current");
              $("#show_actions_lnk").removeClass("step2menuitem_current");
              $("#show_constructor_lnk").addClass("step2menuitem_current");
              calculate();
          }
          function show_actions_info()
          {
		$('.gotoorder a').unbind('click');
              clearAllCookies();
              $.cookie('step2_current_tab', 'actions', { expires: 1 });
                  var action=$('input[name=host_actions]:radio:checked').val();
                  $.cookie('step2_action', action, { expires: 1 });
                  var bitrate=128;
                  $.cookie('bitrate', bitrate, { expires: 1 });
                  $.cookie('webhost', action, { expires: 1 });
                  switch (action) {
                    case '1':
                      var listeners='100';
                      break;
                    case '2':
                      var listeners='250';
                      break;
                    case '3':
                     var listeners='400';
                      break;//case
                  }
                  $.cookie('listeners', listeners, { expires: 1 });
                  findparamsbylisteners(listeners);
                  calculate();
                  makediscount(action);
              $(".constructor").hide();
              $(".plans_info").hide();
              $(".actions_info").fadeIn();
              $("#show_tarifs_lnk").removeClass("step2menuitem_current");
              $("#show_constructor_lnk").removeClass("step2menuitem_current");
              $("#show_actions_lnk").addClass("step2menuitem_current");
          }
	  var IE='\v'=='v';
	  if (IE) {
		document.write('<link rel="stylesheet" type="text/css" href="http://<?php echo $_SERVER['SERVER_NAME'];?>/billing/ie.css" />');
		$(function() {
			$("li").each(function(){
				var margin_left = $( this ).css( "margin-left" );
				margin_left=margin_left.replace("px","");
				if (margin_left>5) {
					margin_left=margin_left-1;
					margin_left=margin_left+"px";
				}
				//alert(margin_left);
				$( this ).css( "margin-left",margin_left );
			});
		});
	  }
        </script>
</head>
<body>
    <div class="mainwrapper">
        <div class="header">
            <div class="logo">
                <?php echo $this->Html->image('footer_logo.png');?>
            </div>
            <div class="rh_lnk">
                <a href="http://radioheart.ru" target="_blank">Radioheart.ru</a> (ссылка откроется в новом окне)
            </div>
        </div>
        <div class="steps">
            <div class="first_step_margin"></div>
            <div class="step arrow_box">Шаг 1. Регистрация</div>
            <div class="step arrow_box">Шаг 2. Заказ</div>
            <div class="step">Шаг 3. Оплата</div>
            <div class="step">Завершение</div>
        </div>
        <div class="content_wrapper">
            <div class="step2menu">
                <div class="step2menuitem step2menuitem_current" id="show_tarifs_lnk"><a href="#" onclick="show_tarifs_info()">Тарифные планы</a></div>
                <div class="step2menuitem" id="show_constructor_lnk"><a href="#" onclick="show_constructior()">Конструктор</a></div>
                <div class="step2menuitem" id="show_actions_lnk"><a href="#" onclick="show_actions_info()">Акции</a></div>
            </div>
            <div class="tarifs_plans">
                <div class="plans_info">
                    <div class="radio_host_plans">
                        <div class="radio_host_switcher">
                            <input type="checkbox" name="radio_host_switcher" class="myradio" value="1" id="radio_host_switcher"/>
                            <label for="radio_host_switcher" class="plans_main_switcher" id="radio_host_switcher_label">Радиохостинг</label>
                        </div>
                        <div class="rh_radio_plans_wrapper">
                            <div class="rh_radio_plans">
                                <div class="rh_radio_plans_bitrates">
                                    Для начала выберите нужный битрейт:
                                    <br /><br />
                                    <table>
                                        <tr>
                                            <td width="265">
                                                <input type="radio" name="radio_host_bitrates" class="myradio radiohostbitrates" value="64" id="radio_host_bitrates_64"/>
                                                <label for="radio_host_bitrates_64" class="plans_main_switcher fontsize13px">64 кбит/с</label>
                                            </td>
                                            <td width="430">
                                                <input type="radio" name="radio_host_bitrates" class="myradio radiohostbitrates" value="128" id="radio_host_bitrates_128" checked="checked"/>
                                                <label for="radio_host_bitrates_128" class="plans_main_switcher fontsize13px">128 кбит/с (рекомендуем: оптимальный выбор)</label>
                                            </td>
                                            <td>
                                                <input type="radio" name="radio_host_bitrates" class="myradio radiohostbitrates" value="192" id="radio_host_bitrates_192"/>
                                                <label for="radio_host_bitrates_192" class="plans_main_switcher fontsize13px">192 кбит/с</label>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                                <div class="rh_radio_plans_desc">
                                    <table>
                                        <tr valign="baseline">
                                            <td width="505">А теперь сам тарифный план:</td>
                                            <td>
                                                <div class="rh_lnk_detailed_info">
                                                    <a href="http://<?php echo $_SERVER['SERVER_NAME']?>/services/radiohosting"  target="_blank">Детальное описание тарифов</a>
                                                    (откроется в новой вкладке)
                                                </div>
                                            </td>
                                        </tr>
                                    </table>
                                    <div style="margin-top:7px;"></div>
                                    <table>
                                        <tr>
                                            <td>
                                                <div class="rh_radio_plans_item">
                                                    <span class="rh_radio_plans_item_title">Radioheart 30</span>
                                                    <br />
                                                    30 слушателей
                                                    <br />
                                                    1 ГБ для автодиджея
                                                    <br /><br />
                                                    <input type="radio" name="radio_host_plans_item" class="myradio radiohostlisteners" value="30" id="radio_host_plans_item_rh_30"/>
                                                    <label for="radio_host_plans_item_rh_30" class="plans_main_switcher fontsize13px">Выбрать</label>
                                                </div>
                                            </td>
                                            <td>
                                                <div class="rh_radio_plans_item">
                                                    <span class="rh_radio_plans_item_title">Radioheart 50</span>
                                                    <br />
                                                    50 слушателей
                                                    <br />
                                                    5 ГБ для автодиджея
                                                    <br /><br />
                                                    <input type="radio" name="radio_host_plans_item" class="myradio radiohostlisteners" value="50" id="radio_host_plans_item_rh_50" />
                                                    <label for="radio_host_plans_item_rh_50" class="plans_main_switcher fontsize13px">Выбрать</label>
                                                </div>
                                            </td>
                                            <td>
                                                <div class="rh_radio_plans_item">
                                                    <span class="rh_radio_plans_item_title">Radioheart 100</span>
                                                    <br />
                                                    100 слушателей
                                                    <br />
                                                    10 ГБ для автодиджея
                                                    <br /><br />
                                                    <input type="radio" name="radio_host_plans_item" class="myradio radiohostlisteners" value="100" id="radio_host_plans_item_rh_100" checked="checked"/>
                                                    <label for="radio_host_plans_item_rh_100" class="plans_main_switcher fontsize13px">Выбрать</label>
                                                </div>
                                            </td>
                                            <td>
                                                <div class="rh_radio_plans_item">
                                                    <span class="rh_radio_plans_item_title">Radioheart 250</span>
                                                    <br />
                                                    250 слушателей
                                                    <br />
                                                    25 ГБ для автодиджея
                                                    <br /><br />
                                                    <input type="radio" name="radio_host_plans_item" class="myradio radiohostlisteners" value="250" id="radio_host_plans_item_rh_250"/>
                                                    <label for="radio_host_plans_item_rh_250" class="plans_main_switcher fontsize13px">Выбрать</label>
                                                </div>
                                            </td>
                                            <td>
                                                <div class="rh_radio_plans_item">
                                                    <span class="rh_radio_plans_item_title">Radioheart 400</span>
                                                    <br />
                                                    400 слушателей
                                                    <br />
                                                    40 ГБ для автодиджея
                                                    <br /><br />
                                                    <input type="radio" name="radio_host_plans_item" class="myradio radiohostlisteners" value="400" id="radio_host_plans_item_rh_400"/>
                                                    <label for="radio_host_plans_item_rh_400" class="plans_main_switcher fontsize13px">Выбрать</label>
                                                </div>
                                            </td>
                                        </tr>
                                    </table>
                                    <div class="rh_plans_line">
                                        <?php echo $this->Html->image('newsline.png',array('class'=>'newsline'));?>
                                    </div>
                                </div>
                            </div>
                            <div class="rh_radio_plans_disabler"></div>
                        </div>
                    </div>
                    <div class="web_host_plans">
                      <div class="web_host_switcher">
                            <input type="checkbox" name="web_host_switcher" class="myradio" value="1" id="web_host_switcher"/>
                            <label for="web_host_switcher" class="plans_main_switcher" id="web_host_switcher_label">Виртуальный хостинг</label>
                      </div>
                      <div class="web_host_descs">
                        <div class="web_host_wrp">
                          <table>
                            <tr valign="baseline">
                              <td width="505">Выберите тарифный план:</td>
                              <td>
                                <div class="rh_lnk_detailed_info">
                                  <a href="http://<?php echo $_SERVER['SERVER_NAME']?>/services/webhosting"  target="_blank">Детальное описание тарифов</a>
                                                      (откроется в новой вкладке)
                                </div>
                              </td>
                            </tr>
                          </table>
                          <div class="web_host_plan_items_wpr">
                            <div class="web_host_item">
                              <span class="web_host_item_title">Extra1</span>
                              <br />
                              2 ГБ
                              <br />
                              10 сайтов
                              <br />
                              5-5-5 FTP-Mysql-Почта
                              <br /><br />
                              <input type="radio" name="web_host_plans_item" class="myradio webhostitem" value="1" id="web_host_plans_item_extra1" checked="checked"/>
                              <label for="web_host_plans_item_extra1" class="plans_main_switcher fontsize13px">Выбрать</label>
                            </div>
                            <div class="web_host_item">
                              <span class="web_host_item_title">Extra2</span>
                              <br />
                              4 ГБ
                              <br />
                              20 сайтов
                              <br />
                              &infin;-&infin;-&infin; FTP-Mysql-Почта
                              <br /><br />
                              <input type="radio" name="web_host_plans_item" class="myradio webhostitem" value="2" id="web_host_plans_item_extra2"/>
                              <label for="web_host_plans_item_extra2" class="plans_main_switcher fontsize13px">Выбрать</label>
                            </div>
                            <div class="web_host_item" style="width:160px;">
                              <span class="web_host_item_title">Extra3</span>
                              <br />
                              10 ГБ
                              <br />
                              50 сайтов
                              <br />
                              &infin;-&infin;-&infin; FTP-Mysql-Почта
                              <br /><br />
                              <input type="radio" name="web_host_plans_item" class="myradio webhostitem" value="3" id="web_host_plans_item_extra3"/>
                              <label for="web_host_plans_item_extra3" class="plans_main_switcher fontsize13px">Выбрать</label>
                            </div>
                          </div>
                        </div>
                        <div class="web_host_disabler"></div>
                      </div>
                    </div>
                </div>
                <div class="constructor" style="display:none;">
                  <table>
                      <tr valign="top">
                          <td width="170">
                              <div class="bitrate_txts">
                                  <span class="constructor_item_title">Битрейт</span>
                                  <span class="constructor_item_descr">(кбит/c)</span>
                              </div>
                          </td>
                          <td width="625">
                              <div class="slider_symbols">
                                  <li>64</li>
                                  <li style="margin-left:181px;">128</li>
                                  <li style="margin-left:184px;">192</li>
                                  <li style="margin-left:174px;">256</li>
                              </div>
                              <div id="bitrate"></div>
                          </td>
                      </tr>
                      <tr valign="top">
                          <td width="170">
                              <div class="bitrate_txts">
                                  <span class="constructor_item_title">Слушатели</span>
                                  <span class="constructor_item_descr">(максимум)</span>
                              </div>
                          </td>
                          <td width="625">
                              <div class="slider_symbols">
                                  <li>50</li>
                                  <li style="margin-left:40px;">100</li>
                                  <li style="margin-left:46px;">150</li>
                                  <li style="margin-left:46px;">200</li>
                                  <li style="margin-left:46px;">250</li>
                                  <li style="margin-left:46px;">300</li>
                                  <li style="margin-left:46px;">350</li>
                                  <li style="margin-left:46px;">400</li>
                                  <li style="margin-left:46px;">450</li>
                                  <li style="margin-left:33px;">500</li>
                              </div>
                              <div id="listeners"></div>
                          </td>
                      </tr>
                      <tr>
                          <td colspan="2">
                              <?php echo $this->Html->image('newsline.png',array('class'=>'newsline'));?>
                          </td>
                      </tr>
                      <tr valign="top">
                          <td width="170">
                              <div class="bitrate_txts">
                                  <span class="constructor_item_title">Автодиджей</span>
                                  <span class="constructor_item_descr">(гигабайты)</span>
                              </div>
                          </td>
                          <td width="625">
                              <div class="slider_symbols">
                                <input type="text" id="amount" style="border: 0;" readonly class="constructor_item_descr"/>
                              </div>
                              <div id="autodj"></div>
                          </td>
                      </tr>
                      <tr>
                          <td colspan="2">
                              <?php echo $this->Html->image('newsline.png',array('class'=>'newsline'));?>
                          </td>
                      </tr>
                      <tr valign="top">
                          <td width="170">
                              <div class="bitrate_txts">
                                  <div style="margin-top:30px"></div>
                                  <span class="constructor_item_title">Дополнительно</span>
                              </div>
                          </td>
                          <td width="625">
                              <span class="sans13red">Перекодировка</span>
                              <div style="margin-top:10px;"></div>
                              <div class="dop_uslugi">
                                  <input type="radio" name="reencode" class="myradio" value="0" id="reencode0" checked="checked" />
                                  <label for="reencode0" class="labelforcheckbox">Не нужна</label>
                                  <input type="radio" name="reencode" class="myradio" value="1" id="reencode1"/>
                                  <label for="reencode1" class="labelforcheckbox">1 поток</label>
                                  <input type="radio" name="reencode" class="myradio" value="2" id="reencode2"/>
                                  <label for="reencode2" class="labelforcheckbox">2 потока</label>
                              </div>
                              <div class="dop_uslugi">
                                  <input type="radio" name="reencode" class="myradio" value="3" id="reencode3"/>
                                  <label for="reencode3" class="labelforcheckbox">3 потока</label>
                                  <input type="radio" name="reencode" class="myradio" value="4" id="reencode4"/>
                                  <label for="reencode4" class="labelforcheckbox">4 потока</label>
                                  <input type="radio" name="reencode" class="myradio" value="5" id="reencode5"/>
                                  <label for="reencode5" class="labelforcheckbox">5 потоков</label>
                              </div>
                              <div class="dop_uslugi statnfade">
                                  <input type="checkbox" name="stats" value="1" class="mycheckbox" id="stats"/>
                                  <label for="stats" class="labelforcheckbox">
                                      <span class="sans13red">Детальная статистика</span>
                                  </label>
                                  <input type="checkbox" name="crossfade" value="1" class="mycheckbox" id="crossfade"/>
                                  <label for="crossfade" class="labelforcheckbox">
                                      <span class="sans13red">Кроссфейдинг</span>
                                  </label>
				  <input type="checkbox" name="cloud_service" value="1" class="mycheckbox" id="cloud_service"/>
                                  <label for="cloud_service" class="labelforcheckbox">
                                      <span class="sans13red">Облачное хранилище</span>
                                  </label>
                              </div>
                          </td>
                      </tr>
                      <tr>
                          <td colspan="2">
                              <?php echo $this->Html->image('newsline.png',array('class'=>'newsline'));?>
                          </td>
                      </tr>
                      <tr valign="top">
                          <td width="170">
                              <div class="bitrate_txts">
                                  <span class="constructor_item_title">Виртуальный хостинг</span>
                                  <span class="constructor_item_descr">(размещение web-сайтов)</span>
                              </div>
                          </td>
                          <td width="625">
                              <div class="extra_wrapper">
                                  <span class="extra_wrapper_title">Extra 1</span><br/>
                                  2 ГБ<br/>
                                  10 сайтов<br/>
                                  PHP<br/>
                                  5 баз MySQL<br/>
                                  5 ftp-аккаунтов<br/>
                                  5 почтовых аккаунтов<br/>
                              </div>
                              <div class="extra_wrapper">
                                  <span class="extra_wrapper_title">Extra 2</span><br/>
                                  4 ГБ<br/>
                                  20 сайтов<br/>
                                  PHP<br/>
                                  &infin; баз MySQL<br/>
                                  &infin; ftp-аккаунтов<br/>
                                  &infin; почтовых аккаунтов<br/>
                              </div>
                              <div class="extra_wrapper">
                                  <span class="extra_wrapper_title">Extra 3</span><br/>
                                  10 ГБ<br/>
                                  50 сайтов<br/>
                                  PHP<br/>
                                  &infin; баз MySQL<br/>
                                  &infin; ftp-аккаунтов<br/>
                                  &infin; почтовых аккаунтов<br/>
                              </div>
                              <div class="dop_uslugi">
                                  <div style="margin-top:20px"></div>
                                  <table>
                                      <tr>
                                          <td width="290">
                                              <input type="radio" name="webhost" value="0" class="mycheckboxhost" id="extra0" checked="checked" />
                                              <label for="extra0" class="labelforcheckbox">
                                                  Мне не нужен хостинг сайтов
                                              </label>
                                              <input type="radio" name="webhost" value="2" class="mycheckboxhost" id="extra2" />
                                              <label for="extra2" class="labelforcheckbox">
                                                  <span class="sans13red">Extra 2</span>
                                              </label>
                                          </td>
                                          <td>
                                             <input type="radio" name="webhost" value="1" class="mycheckboxhost" id="extra1"/>
                                              <label for="extra1" class="labelforcheckbox">
                                                  <span class="sans13red">Extra 1</span>
                                              </label>
                                              <input type="radio" name="webhost" value="3" class="mycheckboxhost" id="extra3"/>
                                              <label for="extra3" class="labelforcheckbox">
                                                  <span class="sans13red">Extra 3</span>
                                              </label>
                                          </td>
                                      </tr>
                                  </table>
                              </div>
                          </td>
                      </tr>
                      <tr>
                          <td width="170"></td>
                          <td width="625"></td>
                      </tr>
                  </table>
                </div>
                <div class="actions_info" style="display:none;">
                  <table>
                    <tr valign="baseline">
                      <td width="505">Выберите акционный пакет:</td>
                      <td>
                        <div class="rh_lnk_detailed_info">
                          <a href="#"  target="_blank">Детальное описание тарифов</a>
                                                      (откроется в новой вкладке)
                        </div>
                      </td>
                    </tr>
                  </table>
                  <div class="actions_wps">
                    <div class="action_item">
                      <div class="action_content">
                        <span class="action_item_title">Radioheart 100 + Extra 1</span>
                        <br />
                        100 слушателей (128кбит/с)
                        <br />
                        10 ГБ для автодиджея
                        <br /><br />
                        10 сайтов
                        <br />
                        2 ГБ для сайтов
                      </div>
                      <div class="action_select">
                        <input type="radio" name="host_actions" class="myradio host_actions" value="1" id="host_actions_1" checked="checked"/>
                        <label for="host_actions_1" class="plans_main_switcher fontsize13px">Выбрать</label>
                      </div>
                    </div>
                    <div class="action_item">
                      <div class="action_content">
                        <span class="action_item_title">Radioheart 250 + Extra 2</span>
                        <br />
                        250 слушателей (128кбит/с)
                        <br />
                        25 ГБ для автодиджея
                        <br /><br />
                        20 сайтов
                        <br />
                        4 ГБ для сайтов
                      </div>
                      <div class="action_select">
                        <input type="radio" name="host_actions" class="myradio host_actions" value="2" id="host_actions_2"/>
                        <label for="host_actions_2" class="plans_main_switcher fontsize13px">Выбрать</label>
                      </div>
                    </div>
                    <div class="action_item">
                      <div class="action_content">
                        <span class="action_item_title">Radioheart 400 + Extra 3</span>
                        <br />
                        400 слушателей (128кбит/с)
                        <br />
                        40 ГБ для автодиджея
                        <br /><br />
                        50 сайтов
                        <br />
                        10 ГБ для сайтов
                      </div>
                      <div class="action_select">
                        <input type="radio" name="host_actions" class="myradio host_actions" value="3" id="host_actions_3"/>
                        <label for="host_actions_3" class="plans_main_switcher fontsize13px">Выбрать</label>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="result_wrapper">
                    <table>
                        <tr>
                            <td width="100">
                                <div class="result_text">Итого:</div>
                            </td>
                            <td width="400">
                                <div class="result_calculating">
                                    <span style="font-size: 12px;color:#cb3c3c;">Радиохостинг</span>
                                    <br/>
                                    <span id="radiohostbitrate"></span>
                                    <br/>
                                    <span id="radiohostautodj"></span>
                                    <br/>
                                    <span id="radiohostreencode"></span>
                                    <br/>
                                    <span id="radiohoststats"></span>
                                    <br/>
                                    <span id="radiohostcrossfade"></span>
                                    <br/>
				    <span id="radiohostcloud_service"></span>
                                    <br/>
                                    <span style="font-size: 12px;color:#cb3c3c;">Хостинг сайтов</span>
                                    <br/>
                                    <span id="webhost"></span>
                                </div>
                            </td>
                            <td>
                                <span style="font-size:24px;color:#d10f0f;" id="result_cost">0 $</span>
                                <span style="font-size:24px;">в месяц</span>
                                <br/>
                                <span style="font-size:14px;color:#d10f0f;" id="sale3month"></span> <span style="font-size:14px;">в месяц при оплате на 3 месяца</span><br/>
                                <span style="font-size:14px;color:#d10f0f;" id="sale6month"></span> <span style="font-size:14px;">в месяц при оплате на полгода</span><br/>
                                <span style="font-size:14px;color:#d10f0f;" id="sale12month"></span> <span style="font-size:14px;">в месяц при оплате на год</span>
                                <br/><br/>
                                <div class="gotoorder"><?php echo  $this->Html->link('Перейти к заказу', array('controller' => 'orders','action' => 'confirm'));?></div>
                            </td>
                        </tr>
                    </table>
                </div>
                <div class="skip_steps">
                  <?php echo  $this->Html->link('Пропустить', array('controller' => 'pages','action' => 'home','skipsteps'));?> (вы перейдете в биллинг)
                </div>
            </div>
        </div>
    </div>
    <div class="footer_wrapper">
        <div class="footer">
            <div class="footer_copies">©  2013  Компания «Radioheart.ru»</div>
            <div class="rh_lnk_footer">
                <a href="http://radioheart.ru" target="_blank">Radioheart.ru</a> (ссылка откроется в новом окне)
            </div>
        </div>
    </div>
</body>
</html>